import Http from '../http';

// 分页查询
export const selectDeptTree = function() {
    return Http.post('/sysDept/selectDeptTree')
}

// 分页查询
export const listByLimit = function(queryWhere: any) {
    return Http.post('/sysUser/queryForPage',queryWhere)
}
// 部门树查询
export const queryTree = function(deptId: any) {
    return Http.post(`/sysDept/queryToTree?deptId=${deptId}`,{})
}

// 超级管理员新增部门
export const saveByLeader = function(deptInfo: any) {
    return Http.post('/sysDept/save',deptInfo)
}

export const saveUserBySuper = function(userInfo: any) {
   return Http.post('/sysUser/insertBySuper',userInfo)
}

// 删除用户（使用请求体传递id列表）
export const deleteUserByIds = function(idList: URLSearchParams) {
    return Http.delete('/sysUser/dels', idList)
}

// 超级管理员编辑用户
export const updateBySuper = function(userInfo: any) {
    return Http.put('/sysUser/updateUser',userInfo)
}



export const delsByBatchUserSuper = function(delUrl: any) {
    return Http.delete(`/sysUser/dels${delUrl}`,{})
}

/**
 * 
 * @param userId 获取部门的详情
 * @returns 
 */
export const queryDetail = function(deptId: any) {
    return Http.get(`/sysDept/queryOne/${deptId}`,{})
}


// 超级管理员批量删除组织
export const delsByLeader = function(delId: any) {
    return Http.delete(`/sysDept/dels?idList=${delId}`,{})
}


// 分页查询
export const listByLimitUser = function(queryWhere: any) {
    return Http.post('/sysUser/queryForPage',queryWhere)
}